import React, {Component} from "react";

export default function hocFilterLogin(WrapperComponent) {
  return class extends Component {
    //拦截的操作
    //是否登录

    componentWillMount() {
      if (!localStorage.getItem('token')) {
        this.props.history.replace('/login');
      }
    }

    render() {
      return (
        <>
          <WrapperComponent {...this.props}/>
        </>
      );
    }
  }
}
